package com.example.mobile203zlw20216061300427;

import android.content.Context;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import org.w3c.dom.Text;

import java.util.List;

public class main_Adapter  extends RecyclerView.Adapter<main_Adapter.Adaptet> {
    private List<MAIN_STOPlset>list;
    private Context context;

    public main_Adapter(List<MAIN_STOPlset> list, Context context) {
        this.list = list;
        this.context = context;
    }
    @NonNull
    @Override
    public Adaptet onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new Adaptet(View.inflate(context,R.layout.main_recylerview,null));
    }

    @Override
    public void onBindViewHolder(@NonNull Adaptet holder, int position) {
        MAIN_STOPlset main_stoPlset=list.get(position);
        holder.tv_top.setText(main_stoPlset.getTv_top());
        holder.tv_kongwei.setText(String.valueOf(main_stoPlset.getTv_kongwei()));
        holder.tv_mony.setText(main_stoPlset.getTv_mony());
        holder.tv_distance.setText(main_stoPlset.getTv_distance());
        holder.tv_xingxi.setText(main_stoPlset.getTv_xingxi());
        holder.tv_dizi.setText(main_stoPlset.getTv_dizi());
        holder.imageView.setImageAlpha(main_stoPlset.getPc());

    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class Adaptet extends RecyclerView.ViewHolder {
        private TextView tv_top,tv_kongwei,tv_mony,tv_distance,tv_xingxi,tv_dizi;
        private ImageView imageView;
        public Adaptet(@NonNull View itemView) {
            super(itemView);
            tv_top=itemView.findViewById(R.id.tv_top);
            tv_kongwei=itemView.findViewById(R.id.tv_kongwei);
            tv_mony=itemView.findViewById(R.id.tv_mony);
            tv_distance=itemView.findViewById(R.id.tv_distance);
            tv_xingxi=itemView.findViewById(R.id.tv_xingxi);
            tv_dizi=itemView.findViewById(R.id.tv_dizi);
            imageView=itemView.findViewById(R.id.picture);
        }
    }
}
